﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DbLayer
{
    class DbEmployee
    {
        public void AddLocation(Location location)
        {
            string statement = BuildInsertStatement("Location", "1", location.Identifier);
            ExecuteStatement(statement);
        }

        public Location GetLocation(int id)
        {
            string statement = BuildSelectStatement("Location", "id ='" + id.ToString() + "'");
            SqlDataReader dataReader = ExecuteQuery(statement);

            return BuildLocation(dataReader);

        }

        private Location BuildLocation(SqlDataReader reader)
        {

            Location loc = null;

            if (reader.Read())
            {
                loc = new Location();
                loc.Identifier = reader["Identifier"].ToString();
            }

            return loc;


        }
    }
}
